﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddComment.aspx.cs" Inherits="ZX.WebApp.Crm.Hodometer.AddComment" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
<link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />

</head>
<body class="yui-skin-sam">
    <form id="form1" runat="server">
    <div id="listpage">
        <div id="toolbar">
        </div>
        <div id="data">
              <table class="tableContent">
                    <tr><td width="400px">
                        <textarea id="txtComment" runat="server" style="width:95%" rows="8" title="长度不超过200个汉字"   onKeyDown="showSetNum('txtComment','spVideo',200)" onKeyUp="showSetNum('txtComment','spVideo',200)"  ></textarea>
                    </td></tr>
                    <tr><td>
                    <span id="spVideo" class="span_font"></span>
                    </td></tr>
                </table> 
                 <button id="btnSave" type="button" style="width: 40px;">发表</button>
                 <input type="hidden" runat="server" id="hdnTeachID" />
        </div>
    </div>
    </form>
</body>
<script type="text/javascript">
  
    //var RoleID = getPar1("RoleID");

    (function () {
       // RoleID = getPar1("RoleID");
        var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event;
        Event.onDOMReady(function () {
            var layout = new YAHOO.widget.Layout({
                units: [
                    {position: 'center', body: 'data', gutter: '1 1', scroll: true }
                ]
            });
            layout.render();
        });
    })();

    YAHOO.example.init = function () {

        // "click" event handler for each Button instance
        function onButtonClick(p_oEvent) {
            YAHOO.log("You clicked button: " + this.get("id"), "info", "example1");
            switch (this.get("id")) {
                case "btnSave":
                    fnSave();
                    break;
                default:
                   // fnSave();
                    break;
            }
        }

        YAHOO.util.Event.onContentReady("toolbar", function () {
            var btnSave = new YAHOO.widget.Button("btnSave");
            btnSave.on("click", onButtonClick);
        });
    } ();
    var instance = [{ "Caption": "aaaaaaaaa"}];
    //保存
    var fnSave = function () {
        var Url;
       
        var type = getPar1("type");
        setValue();
        var json = $.toJSON(instance[0]).replace(/'/g, "[B]");
        if (type == 0) {  //新增
            Url = "../../EditWidows/OrganizationalManager/DataProcessin.aspx?entity=CrmInnerComment&action=Insert&json=" + encodeURI(json);
        } else { //修改
            Url = "../../EditWidows/OrganizationalManager/DataProcessin.aspx?entity=CrmInnerComment&action=Update&json=" + encodeURI(json);
        }
        YAHOO.util.Connect.asyncRequest('POST', Url, {
            success: function (res) {
                var inventory;
                try {
                    inventory = res.responseText;
                    if (inventory == 1) {
                        alert("评论成功!");
                    } else {
                        alert(inventory);
                    }
                    closeWin();
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    };
    var setValue = function () { 
        instance[0].ComContent = $("#txtComment").val();
        instance[0].InnerSumID = getPar1("id");
        instance[0].TeachID = $("#hdnTeachID").val();
    }
 
    //关闭窗口
    function closeWin() {
        parent.YAHOO.example.container.dialog1.hide();
    }
</script>
